<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<head>
<meta name="nav" content="1" />
<meta name="acc" content="2-0" />
<title>我的计划</title>
<script>
$(document).ready(function() {
	$("#planstarDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',minDate:'1900-10-01', dateFmt:'yyyy-MM-dd HH:mm:ss'});});
	$("#planendDate").addClass("Wate").bind("click", function(){
		 WdatePicker({skin:'whyGreen',minDate:'#F{$dp.$D(\'planstarDate\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'});
	     });
	 //为第一个文本框获得焦点
	  $("#title").focus();
	 //验证
	 $("#inputForm").validate({
		 rules:{
			 title:{
				 required:true,
			 },
			 publisher:{
				 required:true,
			 },
			 planstarDate:{
				 required:true,
			 },
			 planendDate:{
				 required:true,
			 }
		 },
		 messages:{
			 title:{
				 required:"必须填写计划标题！"
			 },
			 publisher:{
				 required:"请您登录后操作！"
			 },
			 planstarDate:{
				 required:"请输入计划开始时间！"
			 },
			 planendDate:{
				 required:"请输入计划结束时间！"
			 }
		 }
	 });
});	
</script>
</head>
<body>
	<form action="${ctx}/app/plan!save.action" method="post" id="inputForm"
		class='yform' enctype="multipart/form-data">
		<div id="caption" ><h6>我的计划</h6></div>
		<input name="id" type="hidden" value="${id}" />
		<table class="noborder">
			<tr>
				<td>主题</td>
				<td><input name="title" value="${title}" id="title" type="text"></input>
				</td>
				<td>发布人</td>
				<td><c:choose>
						<c:when test="${id==null}">
							<input type="text" id="publisher" name="publisher"
								value="${user.userName}" readonly="readonly" class="readonly" />
						</c:when>
						<c:otherwise>
							<input type="text" id="publisher" name="publisher"
								value="${publisher}" readonly="readonly"  class="readonly" />
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr class="type-text">
				<td>计划开始日期</td>
				<td><input type="text" id="planstarDate" name="planstarDate"
					readonly="readonly" value="${planstarDate}" />
				</td>
				<td>计划失效日期</td>
				<td><input type="text" id="planendDate" name="planendDate"
					value="${planendDate}" />
				</td>
			</tr>
				<tr>
				<td>计划类型</td>
				<td><pt:code category="1006" name="type" default="${type }" />
				</td><td></td><td></td></tr>
				<tr>
				<td>附件</td>
				<td colspan="3"><input type="file" name="attachmention.upfile" size="40"></input>
				</td></tr>
				<c:if test="${not empty attachment.id}">
				<tr id="attachment">
				<td>已有附件</td>
				<td colspan="3">
				<a title="下载"
					href="${ctx}/servlet/annex?id=${attachment.id}">${attachment.upfileFileName}</a>
				<span onclick="deleteAttachment('${attachment.id}')" class="delete" title="删除附件"></span>
				</td>
			</tr>
			</c:if>
			<tr>
				<td>内容</td>
				<td colspan="3"><textarea name="content" rows="3">${content}</textarea>
				</td>
			</tr>
			<tr>
				<td>备注</td>
				<td colspan="3"><textarea name="remark" rows="3">${remark}</textarea></td>
			</tr>
		</table>
		<div class="type-button">
			<input   type="submit" class="submit" value="提交" />&nbsp;
			<input   type="reset" value="返回" class="reset"
				onclick="history.back()" />
		</div>
	</form>
</body>